#ifndef __SE_SPLIT_TOOL_HPP__
#define __SE_SPLIT_TOOL_HPP__

#include "Configuration.hpp"
#include "cppjieba/Jieba.hpp"

#include <vector>
#include <string>

namespace se {
const char * const DICT_PATH = "./include/dict/jieba.dict.utf8";//最大概率法(MPSegment: Max Probability)分词所使用的词典路径
const char * const HMM_PATH = "./include/dict/hmm_model.utf8";//隐式马尔科夫模型(HMMSegment: Hidden Markov Model)分词所使用的词典路径
const char * const USER_DICT_PATH = "./include/dict/user.dict.utf8";//用户自定义词典路径
const char* const IDF_PATH = "./include/dict/idf.utf8";//IDF路径
const char* const STOP_WORD_PATH = "./include/dict/stop_words.utf8";//停用词路径

// 分词工具基类，暂时只需要派生中文分词工具
class SplitTool {
public:
    virtual ~SplitTool() { }
    virtual void cut(const std::string &sentence, std::vector<std::string> &words) = 0;
};

// 中文分词工具类
class SplitToolCppJieba : public SplitTool {
public:
    SplitToolCppJieba()
    :_jieba(DICT_PATH, HMM_PATH, USER_DICT_PATH, IDF_PATH, STOP_WORD_PATH) {}

    std::vector<std::string> operator()(const std::string str){
        std::vector<std::string> words; 
        _jieba.CutAll(str, words);
        return words;
    }

    void cut(const std::string &sentence, std::vector<std::string> &words){
        _jieba.CutAll(sentence, words);
    }
private:
    cppjieba::Jieba _jieba;
};

}  // namespace se

#endif
